﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Links;
using Base;

public partial class admin_Links_LinksAdd : Base.BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckRights("Basic", "C1");
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            TLinks TLink = new TLinks();
            if (radLinkType.Checked == true)
            {
                TLink.LinkType = int.Parse(radLinkType.Value);
            }
            else
            {
                TLink.LinkType = int.Parse(radLinkType1.Value);
            }
            TLink.WebName = txtWebName.Text;
            TLink.WebURL = txtWebURL.Text;
            if (radLinkType.Checked == true)
            {
                TLink.WebLOGO = ImgUrl1.Value;
            }
            else
            {
                TLink.WebLOGO = "../../Images/System/wutu.gif";
            }
            TLink.WebIntro = txtWebIntro.Text;
            TLink.WebAdmin = txtWebAdmin.Text;
            TLink.Email = txtEmail.Text;
            TLink.Verify = Convert.ToBoolean(radlVerify.Text);

            TLink.Sequence = txtSequence.Text;
            ILinks RLink = new RLinks();
            RLink.Insert(TLink);
            ShowMessage("友情链接添加成功！", "Links/LinksManage.aspx");
        }
        catch (Exception ex)
        {
            ShowMessage("友情链接添加失败！", "Links/LinksManage.aspx");
        }
        ShowMessage(Convert.ToBoolean(radlVerify.Text).ToString());
    }
    
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("LinksManage.aspx");
    }
}
